import java.util.Random;
import java.util.Scanner;

public class Game {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        Random random=new Random();
        //int n= random.nextInt(2);
        int count=1;
        int score=0;

        while(count<=3){
            System.out.println("** 第"+count+"局  **");
            System.out.println("————————————————");
            System.out.println("请输入你的选择：  ");
            System.out.println("0--石头         ");
            System.out.println("1--剪刀         ");
            System.out.println("2--布           ");
            System.out.println("————————————————");

            int m= scanner.nextInt();
            int n= random.nextInt(2);
            System.out.println("电脑出："+n);
            if(m>2||m<0){
                System.out.println("输入不合法，请重新输入");
                continue;
            }
            count++;
            if(n-m==-1||n-m==2){
                score--;
                System.out.println("输了一局哟~");
            }
            else{
                score++;
                System.out.println("赢了一局哟~~");
            }
        }

        if(score==0){
            System.out.println("平局");
        }
        else if(score<0){
            System.out.println("输咯");
        }else{
            System.out.println("恭喜！赢了！");
        }

    }
}
